package com.example.mybiadushoujiweishi.activity.acivitys.fragments;

import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/5/16 0016.
 */

public abstract class Basefragment extends DialogFragment {
  Unbinder unbinder;
    protected View v;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        v=inflater.inflate(getContentXml(),container,false);
        unbinder=ButterKnife.bind(this,v);
        getContentView(v);
        return v;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog= super.onCreateDialog(savedInstanceState);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        return  dialog;
    }

    public abstract int getContentXml();


    public abstract void getContentView(View view);

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (unbinder!=null)
        {
            unbinder.unbind();
        }

    }
}



